<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>调血申请</title>
    <link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
    <link rel="stylesheet" href="/element-theme/blue/index.css">
    
</head>

<body>
    <div class="data-manage-table">
        <template>

            <el-form ref="form" :inline="true" style="padding:0 20px 0 20px;">
                <!-- <el-button type="primary" style="margin-right: 40px;">批量删除</el-button> -->
                <el-form-item label="申请编号">
                    <el-input v-model="pagination.id" placeholder="请输入申请编号"></el-input>
                </el-form-item>
                <el-form-item label="申请医院名称">
                    <el-select v-model="pagination.applyHosName">
                        <el-option v-for="item in bloodSourceList" :key="item.code" :label="item.source" :value="item.code"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="申请状态">
                    <el-select v-model="pagination.state">
                        <el-option v-for="item in transferStatesList" :key="item.code" :label="item.name" :value="item.code"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="getByQueryPage(1)">搜索</el-button>
                    <el-button type="info" @click="getByQueryPage()">清空</el-button>
                    <el-button type="warning" @click="dialogFormVisible = true">添加</el-button>
                    <el-button type="warning" @click="test()">test</el-button>
                </el-form-item>
            </el-form>


            <el-table :data="tableData" style="width: 100%;" border :header-cell-style="{'text-align': 'center','background': '#eef1f6'}" highlight-current-row
                @current-change=""  @row-dblclick="rowClick" highlight-current-row="true" height="260">
                <el-table-column prop="applyId"         label="申请编号" width="200" align="center"></el-table-column>
                <el-table-column prop="applyHospitalName"               label="医院名称" width="200" align="center">
                    <template slot-scope="scope">
                        {{ getBloodSourceName(scope.row.applyHospitalName) }}
                    </template>
                </el-table-column>
                <el-table-column prop="applicant"           label="申请人" width="100" align="center"></el-table-column>
                <el-table-column prop="applyTime"           label="申请时间" width="200" align="center"></el-table-column>
                <el-table-column prop="state"               label="状态" width="150" align="center">
                    <template slot-scope="scope">
                        {{ getTransferStateName(scope.row.state) }}
                    </template>
                </el-table-column>
                <el-table-column label="操作" width="240" align="center">
                    <template slot-scope="scope">
                        <el-button size="mini" type="danger" @click="reviseDialogVisible=true;revise(scope.row)" :disabled="scope.row.state != '0'">修改</el-button>
                        <el-button size="mini" type="danger" @click="deleteConfirmDialog = true;getDelete(scope.row)" :disabled="scope.row.state != '0'">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!-- 添加申请 -->
            <el-dialog title="提示" :visible.sync="deleteConfirmDialog" width="30%" @close="cancel">
                <span>确认删除</span>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="deleteConfirmDialog = false">取 消</el-button>
                    <el-button type="primary" @click="deleteOne()">确 定</el-button>
                </span>
            </el-dialog>



            <!-- 添加申请 -->
            <el-dialog title="添加调血申请" :visible.sync="dialogFormVisible">
                <el-descriptions title="" :content-style="rowCenter" :label-style="rowCenter" :column="2" border>
                    <el-descriptions-item>
                        <template slot="label" align="center">
                            申请医院名称
                        </template>
                        <el-select v-model="dynamicValidateForm.applyHosName">
                            <el-option v-for="item in bloodSourceList" :key="item.code" :label="item.source" :value="item.code"></el-option>
                        </el-select>
                    </el-descriptions-item>
                </el-descriptions>
                <el-form :model="dynamicValidateForm" ref="dynamicValidateForm"  class="demo-dynamic">
<!--                    <el-form-item label="申请医院名称" :label-width="formLabelWidth" >-->
<!--                        <el-input v-model="dynamicValidateForm.applyHosName"></el-input>-->
<!--                    </el-form-item>-->
                    <el-form-item v-for="(bloodInfList,index) in dynamicValidateForm.bloodInfLists" :label="'血液信息' + (index+1)"
                                  :key="bloodInfList.key" style="margin-top: 20px;margin-left: 40px" >
                        <el-select v-model="bloodInfList.bloodComponent"  style="width:15%;margin-left: 10px" placeholder="血液成分">
                            <el-option
                                    v-for="item in bloodComponentList" :key="item.code" :label="item.composition" :value="item.code">
                            </el-option>
                        </el-select>
                        <el-select v-model="bloodInfList.aboType" style="width:15%;margin-left: 10px" placeholder="ABO血型">
                            <el-option v-for="item in aboBloodTypeList" :key="item.code" :label="item.name" :value="item.code">
                            </el-option>
                        </el-select>
                        <el-select v-model="bloodInfList.rhType" style="width:15%;margin-left: 10px" placeholder="Rh血型">
                            <el-option v-for="item in rhBloodTypeList" :key="item.code" :label="item.name" :value="item.code">
                            </el-option>
                        </el-select>
                        <el-select v-model="bloodInfList.specification" style="width:15%;margin-left: 10px" placeholder="规格">
                            <el-option v-for="item in specificationList" :key="item.code" :label="item.size" :value="item.code">
                            </el-option>
                        </el-select>
                        <el-button @click.prevent="removeBloodInfList(bloodInfList)" type="danger" style="margin-left: 10px">删除</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-button @click="addBloodInfList" type="primary" style="margin-top: 10px;margin-left: 20px">新增血液信息</el-button>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="dialogFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="addApplication()">确 定</el-button>
                </div>
            </el-dialog>



            <!--申请血液详情-->
            <el-drawer
                    title="申请血液详情"
                    :visible.sync="bloodDetailVisible"
                    direction="rtl"
                    size="40%">
                <el-table :data="bloodDetail" style="width: 100%;" border :header-cell-style="{'text-align': 'center','background': '#eef1f6'}" highlight-current-row
                          @current-change=""  highlight-current-row="false" height="250" >
                    <el-table-column prop="bloodComponent"  label="血液成分" width="200" align="center">
                        <template slot-scope="scope">
                            {{ getBloodComponentName(scope.row.bloodComponent) }}
                        </template>
                    </el-table-column>
                    <el-table-column prop="aboType"         label="ABO血型" width="100" align="center">
                        <template slot-scope="scope">
                            {{ getAboBloodName(scope.row.aboType) }}
                        </template>
                    </el-table-column>
                    <el-table-column prop="rhType"          label="Rh血型" width="100" align="center">
                        <template slot-scope="scope">
                            {{ getRhBloodName(scope.row.rhType) }}
                        </template>
                    </el-table-column>
                    <el-table-column prop="specification"          label="规格" width="100" align="center">
                        <template slot-scope="scope">
                            {{ getBloodSizeName(scope.row.specification) }}
                        </template>
                    </el-table-column>
                </el-table>
            </el-drawer>

            <!-- 修改调血申请 -->
            <el-dialog title="修改调血申请" :visible.sync="reviseDialogVisible">
                <el-descriptions title="" :content-style="rowCenter" :label-style="rowCenter" :column="2" border>
                    <el-descriptions-item>
                        <template slot="label" align="center">
                            申请编号
                        </template>
                        {{reviseDialogForm.applyId}}
                    </el-descriptions-item>
                    <el-descriptions-item>
                        <template slot="label" align="center">
                            申请医院名称
                        </template>
                        {{getBloodSourceName(reviseDialogForm.applyHosName)}}
                    </el-descriptions-item>
                </el-descriptions>
                <el-form :model="reviseDialogForm" ref="reviseDialogForm"  class="demo-dynamic">
                    <el-form-item v-for="(bloodInfList,index) in reviseDialogForm.bloodInfLists" :label="'血液信息' + (index+1)"
                                  :key="bloodInfList.key" style="margin-top: 20px;margin-left: 40px" >
                        <el-select v-model="bloodInfList.bloodComponent"  style="width:15%;margin-left: 10px" placeholder="血液成分">
                            <el-option
                                    v-for="item in bloodComponentList" :key="item.code" :label="item.composition" :value="item.code">
                            </el-option>
                        </el-select>
                        <el-select v-model="bloodInfList.aboType" style="width:15%;margin-left: 10px" placeholder="ABO血型">
                            <el-option v-for="item in aboBloodTypeList" :key="item.code" :label="item.name" :value="item.code">
                            </el-option>
                        </el-select>
                        <el-select v-model="bloodInfList.rhType" style="width:15%;margin-left: 10px" placeholder="Rh血型">
                            <el-option v-for="item in rhBloodTypeList" :key="item.code" :label="item.name" :value="item.code">
                            </el-option>
                        </el-select>
                        <el-select v-model="bloodInfList.specification" style="width:15%;margin-left: 10px" placeholder="规格">
                            <el-option v-for="item in specificationList" :key="item.code" :label="item.size" :value="item.code">
                            </el-option>
                        </el-select>

                        <el-button @click.prevent="removeReviseBloodInfList(bloodInfList)" type="danger" style="margin-left: 10px">删除</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-button @click="addReviseBloodInfList" type="primary" style="margin-top: 10px;margin-left: 20px">新增血液信息</el-button>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="reviseDialogVisible = false">取 消</el-button>
                    <el-button type="primary" @click="reviseConfirm()">确 定</el-button>
                </div>
            </el-dialog>


            <!--分组插件-->
            <div class="pagination-container">
                <el-pagination
                        class="pagination"
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="pagination.currentPage"
                        :page-sizes="[2,4,6,8,10]"
                        :page-size="pagination.pageSize"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="pagination.total"
                        style="text-align: center; margin-top: 10px; margin-bottom: 10px;">
                </el-pagination>
            </div>


        </template>
    </div>



    <script src="/plugins/vue-2.6.11/vue.js"></script>
    <script src="/plugins/element-2.4.5/index.js"></script>
    <script src="/icons/iconfont.js"></script>
    <script src="/js/axios.min.js"></script>
    <script src="/js/2.15.12/index.js"></script>
    <link href="/css/2.15.12/index.min.css" rel="stylesheet">
    <script src="/js/httpVueLoader.js"></script>
    <script src="/js/jquery.min.js"></script>
    <script>Vue.prototype.$ELEMENT = { size: 'medium' };</script>



    <script>

        (function () {


            var vm = window.vm = new Vue({
                el: '.data-manage-table',
                data() {
                    return {

                        rowCenter:{
                            "text-align":"center"
                        },

                        //
                        bloodDetailVisible:false,
                        //删除确认
                        delete:'',
                        deleteConfirmDialog:false,
                        //申请状态列表
                        transferStatesList:[],
                        //血液状态列表
                        stateList : [],

                        //ABO血型列表
                        aboBloodTypeList : [],

                        //Rh血型列表
                        rhBloodTypeList : [],
                        //血液规格
                        specificationList: [],
                        //医院字典
                        bloodSourceList: [],

                        //血液成分列表
                        bloodComponentList : [],
                        bloodDetail:[],
                        //添加申请表单
                        dynamicValidateForm:{
                            applyId:'',
                            applyHosName:'',
                            bloodInfLists:[{
                                bloodComponent:'',
                                aboType:'',
                                rhType:'',
                                specification:''
                            }]
                        },

                        reviseDialogVisible:false,
                        //修改调血申请
                        reviseDialogForm:{
                            applyId:'',
                            applyHosName:'',
                            bloodInfLists:[{
                                bloodComponent:'',
                                aboType:'',
                                rhType:'',
                                specification:''
                            }]
                        },

                        //添加功能表格
                        dialogTableVisible: false,
                        dialogFormVisible: false,
                        formLabelWidth: '120px',

                        //分页相关信息
                        pagination: {
                            currentPage: 1,
                            pageSize: 4,
                            total: 0,
                            //查询条件
                            id:'',
                            applyHosName : '',
                            state : '',
                        },

                        //样本位置
                        location: [],

                        //弹出框显示
                        dialogVisible: false,

                        //搜索样本信息
                        searchSample: {
                        },

                        //表格信息
                        tableData: [],

                        //血液信息
                        bloodData:[],

                        user:{
                            "username":"tom1",
                            id: 1000
                        }

                    }
                },

                //自动触发写入函数
                created(){
                    this.getByQueryPage();

                },
                mounted() {
                    this.getState();
                    this.getAboBloodType();
                    this.getRhBloodType();
                    this.getBloodComponent();
                    this.getTransferState();
                    this.getBloodSize();
                    this.getBloodSource();
                },

                methods: {
                    test(){alert(this.getBloodComponentCode('全血'))},

                    //
                    handleClose(){
                        window.setTimeout(function () {
                            window.location.reload();
                        },100)//2秒
                    },

                    //申请修改
                    revise(row){
                        this.reviseDialogForm.applyId = row.applyId;
                        this.reviseDialogForm.applyHosName = row.applyHospitalName;
                        axios.get('/applyinformation/normal/getAll',
                            {params:{
                                    id:row.applyId
                                }
                            }).then((res)=>{
                            if(res.data.code=="200"){
                                this.reviseDialogForm.bloodInfLists=res.data.data;
                                // for(var i=0;i<res.data.data.length;i++){
                                //     this.reviseDialogForm.bloodInfLists[i] = res.data.data[i];
                                // }
                            }
                        });
                    },

                    //修改确认
                    reviseConfirm(){
                        axios.get('/applyinformation/normal/clear',
                            {params:{
                                    id:this.reviseDialogForm.applyId,
                                }
                            }).then((res)=>{if(res.data.code == '200'){
                            var applyId = this.reviseDialogForm.applyId;
                            console.log("长度： " + this.reviseDialogForm.bloodInfLists.length)
                            for(var i = 0;i < this.reviseDialogForm.bloodInfLists.length;i++){
                                axios.get('/applyinformation/normal/addOne',{
                                    params:{
                                        applyId:applyId,
                                        bloodComponent:this.reviseDialogForm.bloodInfLists[i].bloodComponent,
                                        aboType:this.reviseDialogForm.bloodInfLists[i].aboType,
                                        rhType:this.reviseDialogForm.bloodInfLists[i].rhType,
                                        specification:this.reviseDialogForm.bloodInfLists[i].specification
                                    }
                                })
                            };
                        }});
                        this.$notify.success({
                            title : '成功',
                            message : '修改成功'
                        });
                        reviseDialogVisible = false;
                        this.handleClose();
                    },

                    //获取需要删除的ID
                    getDelete(row){
                        this.delete = row.applyId;
                    },

                    rowClick(row){
                        this.bloodDetailVisible=true;
                        axios.get('/applyinformation/normal/getAll',
                            {params:{
                                id:row.applyId
                                }
                            }).then((res)=>{
                                console.log("****************")
                                    console.log(res.data);
                                    if(res.data.code=="200"){
                                        console.log(res.data.data)
                                        this.bloodDetail = res.data.data;
                                        }
                                });
                        },
                    getByQueryPage:function(flag){
                        if(flag != 1){
                            this.pagination.id = '';
                            this.pagination.applyHosName = '';
                            this.pagination.state = '';
                            this.pagination.currentPage = 1;
                        }
                        axios.get('/bloodtransfer/normal/' + this.pagination.currentPage + '/' + this.pagination.pageSize,
                            {
                                params:{
                                    applyId : this.pagination.id,
                                    applyHospitalName : this.pagination.applyHosName,
                                    state :this.pagination.state,
                                }
                            }).then((res)=>{
                                console.log(res.data);
                            if (res.data.code === "200") {
                                this.pagination.pageSize = res.data.data.size;
                                this.pagination.currentPage = res.data.data.current;
                                this.pagination.total = res.data.data.total;
                                this.tableData = Object.values(res.data.data.records);
                            } else{
                                this.$message.success("查询失败");
                            }
                        });
                    },

                    // 获取血液状态字典
                    getState(){
                        axios.get('/state/normal/getName')
                            .then((res)=>{
                                if (res.data.code === '200'){
                                    this.stateList = res.data.data
                                } else {
                                    this.$notify.error({
                                        title : '错误',
                                        message : '获取数据失败'
                                    })
                                }
                            })
                    },
                    // 将表格中的State字段的code转换成name
                    getStateName(code){
                        for (var i=0;i<this.stateList.length;i++){
                            if (this.stateList[i].code == code){
                                return this.stateList[i].state
                            }
                        }
                    },

                    // 获取申请状态字典
                    getTransferState(){
                        axios.get('/transferState/normal/getName')
                            .then((res)=>{
                                if (res.data.code === '200'){
                                    this.transferStatesList = res.data.data
                                } else {
                                    this.$notify.error({
                                        title : '错误',
                                        message : '获取数据失败'
                                    })
                                }
                            })
                    },
                    // 将表格中的State字段的code转换成name
                    getTransferStateName(code){
                        for (var i=0;i<this.transferStatesList.length;i++){
                            if (this.transferStatesList[i].code == code){
                                return this.transferStatesList[i].name
                            }
                        }
                    },
                    // 将表格中的State字段的name转换成code
                    getTransferStateCode(name){
                        for (var i=0;i<this.transferStatesList.length;i++){
                            if (this.transferStatesList[i].name == name){
                                return this.transferStatesList[i].code
                            }
                        }
                    },

                    // 获取abo血型字典
                    getAboBloodType(){
                        axios.get('/aboType/normal/getName')
                            .then((res)=>{
                                if (res.data.code === '200') {
                                    this.aboBloodTypeList = res.data.data
                                } else {
                                    this.$notify.error({
                                        title: '错误',
                                        message: '获取数据失败',
                                    })
                                }
                            })
                    },
                    // 将表格中aboBloodType字段的code转换成name
                    getAboBloodName(code){
                        for (var i = 0; i < this.aboBloodTypeList.length; i++) {
                            if (this.aboBloodTypeList[i].code == code) { //dictValue，dictLabel保持和上面定义一致
                                return this.aboBloodTypeList[i].name;
                            }
                        }
                    },
                    // 将表格中aboBloodType字段的code转换成name
                    getAboBloodCode(name){
                        for (var i = 0; i < this.aboBloodTypeList.length; i++) {
                            if (this.aboBloodTypeList[i].name == name) { //dictValue，dictLabel保持和上面定义一致
                                return this.aboBloodTypeList[i].code;
                            }
                        }
                    },

                    // 获取rh血型字典
                    getRhBloodType(){
                        axios.get('/rhType/normal/getName')
                            .then((res)=>{
                                if (res.data.code === '200') {
                                    this.rhBloodTypeList = res.data.data
                                } else {
                                    this.$notify.error({
                                        title: '错误',
                                        message: '获取数据失败',
                                    })
                                }
                            })
                    },
                    // 将表格中rhType字段的code转换成name
                    getRhBloodName(code){
                        for (var i = 0; i < this.rhBloodTypeList.length; i++) {
                            if (this.rhBloodTypeList[i].code == code) { //dictValue，dictLabel保持和上面定义一致
                                return this.rhBloodTypeList[i].name;
                            }
                        }
                    },
                    // 将表格中rhType字段的name转换成code
                    getRhBloodCode(name){
                        for (var i = 0; i < this.rhBloodTypeList.length; i++) {
                            if (this.rhBloodTypeList[i].name == name) { //dictValue，dictLabel保持和上面定义一致
                                return this.rhBloodTypeList[i].code;
                            }
                        }
                    },


                    // 获取血液成分字典
                    getBloodComponent(){
                        axios.get('/bloodComposition/normal/getName')
                            .then((res)=>{
                                if (res.data.code === '200') {
                                    this.bloodComponentList = res.data.data
                                } else {
                                    this.$notify.error({
                                        title: '错误',
                                        message: '获取数据失败',
                                    })
                                }
                            })
                    },
                    // 将表格中bloodComponent字段的code转换成name
                    getBloodComponentName(code){
                        for (var i = 0; i < this.bloodComponentList.length; i++) {
                            if (this.bloodComponentList[i].code == code) { //dictValue，dictLabel保持和上面定义一致
                                return this.bloodComponentList[i].composition;
                            }
                        }
                    },
                    // 将表格中bloodComponent字段的name转换成code
                    getBloodComponentCode(composition ){
                        for (var i = 0; i < this.bloodComponentList.length; i++) {
                            if (this.bloodComponentList[i].composition == composition ) { //dictValue，dictLabel保持和上面定义一致
                                return this.bloodComponentList[i].code;
                            }
                        }
                    },
                    // 获取血量字典
                    getBloodSize(){
                        axios.get('/bloodSize/normal/getName1')
                            .then((res)=>{
                                if (res.data.code === '200') {
                                    this.specificationList = res.data.data
                                } else {
                                    this.$notify.error({
                                        title: '错误',
                                        message: '获取数据失败',
                                    })
                                }
                            })
                    },

                    // 将表格中bloodCount字段的code转换成size
                    getBloodSizeName(code){
                        for (var i = 0; i < this.specificationList.length; i++) {
                            if (this.specificationList[i].code == code) { //dictValue，dictLabel保持和上面定义一致
                                return this.specificationList[i].size;
                            }
                        }
                    },

                    // 将表格中bloodCount字段的size转换成code
                    getBloodSizeCode(name){
                        for (var i = 0; i < this.specificationList.length; i++) {
                            if (this.specificationList[i].size == name) { //dictValue，dictLabel保持和上面定义一致
                                return this.specificationList[i].code;
                            }
                        }
                    },
                    // 获取医院字典
                    getBloodSource(){
                        axios.get('/bloodSource/normal/getName')
                            .then((res)=>{
                                if (res.data.code === '200') {
                                    this.bloodSourceList = res.data.data
                                } else {
                                    this.$notify.error({
                                        title: '错误',
                                        message: '获取数据失败',
                                    })
                                }
                            })
                    },

                    // 将表格中BloodSource字段的code转换成source
                    getBloodSourceName(code){
                        for (var i = 0; i < this.bloodSourceList.length; i++) {
                            if (this.bloodSourceList[i].code == code) {
                                return this.bloodSourceList[i].source;
                            }
                        }
                    },

                    // 获取时间
                    // dateFormat(picker) {
                    //     this.pagination.startTime =  picker[0].getFullYear()+'-'+this.handleTimeStr(picker[0].getMonth()+1)+'-'+this.handleTimeStr(picker[0].getDate()) + ' 00:00:00';
                    //     this.pagination.endTime =  picker[1].getFullYear()+'-'+this.handleTimeStr(picker[1].getMonth()+1)+'-'+this.handleTimeStr(picker[1].getDate())+ ' 00:00:00';
                    // },

                    // 分页查询 每页显示多少条数据
                    handleSizeChange:function(pageSize){
                        this.pagination.pageSize = pageSize;
                        this.getByQueryPage(1);
                    },

                    //分页查询 切换页码
                    handleCurrentChange:function(currentPage){
                        this.pagination.currentPage = currentPage;
                        //执行查询
                        this.getByQueryPage(1);
                    },

                    update(row){
                        console.log(row.applyId)
                    },

                    //删除申请
                    deleteOne() {
                        console.log("成功")
                        axios.get('/bloodtransfer/normal/deleteApplication', {
                            params: {
                                applyId: this.delete,
                            }
                        }).then((res) => {
                            if (res.data.code == '200') {
                                this.$notify({
                                    title: '成功',
                                    message: '删除成功',
                                    type: 'success',
                                })
                            }
                        });
                        window.setTimeout(function () {
                            window.location.reload();
                        },1000)//2秒
                    },

                    // 编辑表格
                    editTableData(row){
                        this.bloodNumIndex = row.bloodNumber;
                    },
                    edit(){
                        alert("hello")
                    },
                    handleEdit(index, row) {
                        console.log(index, row);
                    },
                    handleDelete(index, row) {
                        console.log(index, row);
                    },
                    //取消按钮
                    cancel(){

                    },
                    //添加申请
                    addApplication() {
                        console.log(this.getNowTime())
                        axios.get('/bloodtransfer/normal/getId',{
                            params:{
                                id:1000,
                                flag:1000
                            }
                        }).then((res)=>{
                            if(res.data.code=='200'){
                                this.dynamicValidateForm.applyId = res.data.data;
                                axios.get('/bloodtransfer/normal/addApplication', {
                                    params: {
                                        applyHospitalName: this.dynamicValidateForm.applyHosName,
                                        applyId: this.dynamicValidateForm.applyId,
                                        applicant: this.user.username,
                                        applicantId: this.user.id,
                                        applyTime: this.getNowTime(),
                                    }
                                }).then((res) => {
                                    if (res.data.code == '200') {
                                        this.$notify({
                                            title: '成功',
                                            message: '添加成功',
                                            type: 'success',
                                        })
                                    }
                                });
                                var applyId = this.dynamicValidateForm.applyId;
                                this.dynamicValidateForm.bloodInfLists.forEach(
                                    function (item,index,self) {
                                        axios.get('/applyinformation/normal/addOne',{
                                            params:{
                                                applyId:applyId,
                                                bloodComponent:item.bloodComponent,
                                                aboType:item.aboType,
                                                rhType:item.rhType,
                                                specification:item.specification
                                            }
                                        })

                                    }
                                )
                            }
                        })
                            ,
                        window.setTimeout(function () {
                            window.location.reload();
                        },1000)//2秒
                    },

                    // 获取当前时间
                    getNowTime(){
                        var date = new Date();
                        var year = date.getFullYear();
                        var month = date.getMonth()+1;
                        var day = date.getDate();
                        var hour = date.getHours();
                        var minute = date.getMinutes();
                        var second = date.getSeconds();

                        var time = year + '-' + this.handleTimeStr(month) + '-' +
                            this.handleTimeStr(day) + ' ' + this.handleTimeStr(hour) + ':' + this.handleTimeStr(minute)
                            + ':' + this.handleTimeStr(second);
                        console.log(time)
                        return time;
                    },
                    // 时间标准化
                    handleTimeStr(tStr){  // 解决 10:2:2 出现各位数字格式化为 10:02:02
                        if (tStr < 10){
                            return '0'+ tStr
                        }else {
                            return tStr
                        }
                    },
                    //新增动态表单项
                    addBloodInfList(){
                        this.dynamicValidateForm.bloodInfLists.push({
                            bloodComponent:'',
                            aboType:'',
                            rhType:'',
                            specification:''
                        })
                    },
                    //删除动态表单项
                    removeBloodInfList(item){
                        var index = this.dynamicValidateForm.bloodInfLists.indexOf(item)
                        if (index !== -1) {
                            this.dynamicValidateForm.bloodInfLists.splice(index, 1)
                        }
                    },
                    //新增修改动态表单项
                    addReviseBloodInfList(){
                        this.reviseDialogForm.bloodInfLists.push({
                            bloodComponent:'',
                            aboType:'',
                            rhType:'',
                            specification:''
                        })
                    },
                    //删除修改动态表单项
                    removeReviseBloodInfList(item){
                        var index = this.reviseDialogForm.bloodInfLists.indexOf(item)
                        if (index !== -1) {
                            this.reviseDialogForm.bloodInfLists.splice(index, 1)
                        }
                    },

                }

            });
        })()
    </script>

</body>

</html>